package com.taotao.rop.listener;

import com.rop.RopContext;
import com.rop.event.AfterStartedRopEvent;
import com.rop.event.RopEventListener;
import com.taotao.admin.MyRopClient;
import com.taotao.rop.database.domain.BaseDomain;
import com.taotao.rop.response.BaseResponse;
import org.apache.log4j.Logger;

/**
 * 微信模糊匹配的索引建立
 */
public class LuceneAfterStartedRopEventListener implements RopEventListener<AfterStartedRopEvent> {
    private Logger logger = Logger.getLogger(LuceneAfterStartedRopEventListener.class);
    @Override
    public void onRopEvent(AfterStartedRopEvent ropEvent) {
        RopContext ropContext = ropEvent.getRopContext();
        if(ropContext != null && ropContext.getServiceMethodHandler("respSearch.create", "1.0") != null){
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            MyRopClient.getRopClient("").buildClientRequest()
                    .post(new BaseDomain(), BaseResponse.class, "respSearch.create", "1.0");
        }
    }

    @Override
    public int getOrder() {
        return 1;
    }
}
